package com.deuwise.system.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * 
 *@author deuwise
 *@date 2018-11-09 10:29:13
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName(" sys_dept")
public class DeptDO extends Model<DeptDO> implements Serializable {

    /**主键id*/
    @ApiModelProperty("主键id")
    @TableId
    private String id;

    /**父节点Id*/
    @ApiModelProperty("父节点Id")
    @TableField("parent_id")
    private String parentId;

    /**部门名称*/
    @ApiModelProperty("部门名称")
    @TableField("name")
    @NotBlank(message ="部门名称不能为空",groups = {AddGroup.class, UpdateGroup.class})
    @Length(max =60,message ="部门名称长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String name;

    /**排序*/
    @ApiModelProperty("排序")
    @TableField("order_num")
    private Integer orderNum;

    /**删除标识 0否，1删除*/
    @ApiModelProperty("删除标识 0否，1删除")
    @TableField("deleted")
    private Integer deleted;

   @Override
    protected Serializable pkVal() {
        return id;
    }
}